/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.asu.cse360.service.impl;

import edu.asu.cse360.annotation.TargetEntity;
import edu.asu.cse360.dao.DataAccessObject;
import edu.asu.cse360.model.Employee;
import edu.asu.cse360.service.AuthenticationService;
import java.util.LinkedHashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service("authenticationService")
public class AuthenticationServiceImpl implements AuthenticationService{

    @Autowired
    @TargetEntity(Employee.class)
    private DataAccessObject<Employee, Integer> employeeDao;

    @Override
    public Employee authenticate(String username, String password) {
       Map<String, Object> params = new LinkedHashMap<String, Object>();
       params.put("username", username);
       params.put("password", password);
       return employeeDao.findSingleResult("Employee.findByUsernameAndPassword", params);
    }

}
